
interface Option {
    value: string;
    label: string;
    children?: Option[];
}
// 根据 buildingid 查找完整路径
export const findBuildingPath = (id: number, options: Option[] | undefined): string[] | undefined => {
    if (!options) return undefined;
    
    for (const option of options) {
        if (Number(option.value) === id) {
            return [option.value];
        }
        if (option.children) {
            const path = findBuildingPath(id, option.children);
            if (path) {
                return [option.value, ...path];
            }
        }
    }
    return undefined;
};